package com.javaspeak.designpatterns.go4.structural.adapter;

/**
 * The client code in this class wishes to call the draw() method on a Square.
 * <p>
 * We have created a ShapeAdapter which is a wrapper for ShapeImpl.
 * <p>
 * When we call draw() on the ShapeAdapter it internally calls drawSquare() on
 * the ShapeImpl class.
 * <p>
 * We have adapted the share.drawSquare() method so that it is executed when
 * we call square.draw();
 *
 *
 * @author John Dickerson
 */
public class ApplicationAdapter {

    /**
     * In this method we create an adapter for ShapeImpl. When we call
     * square.draw() it internally calls shape.drawSquare()
     */
    public void callClientMethod(){

        Square square = new ShapeAdapter( new ShapeImpl() );
        square.draw();
    }


    /**
     * Main method
     *
     * @param args
     */
    public static void main(String[] args) {

        ApplicationAdapter application = new ApplicationAdapter();
        application.callClientMethod();
    }

}
